{% extends 'base.html' %}

{% load staticfiles %}

{% block title %}
    课程讲师
{% endblock %}

{% block custom_bread_tail %}
    <li>授课教师</li>
{% endblock %}

{% block content %}
    <section>
        <div class="wp butler_list_box list">
            <div class='left'>
                <div class="butler_list layout">
                    <div class="head">
                        <ul class="fl tab_header">
                            <li{% if not sort %} class="active"{% endif %}>
                                <a href="?sort=">全部</a>
                            </li>
                            <li{% if sort %} class="active"{% endif %}>
                                <a href="?sort=hot">人气 &#8595;</a>
                            </li>
                        </ul>
                        <div class="fr butler-num">共<span class="key">{{ teacher_nums }}</span>人&nbsp;&nbsp;&nbsp;</div>
                    </div>

                    {# 全部讲师 #}
                    {% for teacher in teacher_paginator.object_list %}
                        <dl class="des">
                            <dt>
                                <a href="{% url 'org:teacher_detail' teacher.id %}">
                                    <div class="picpic">
                                        <img width="100" height="100" class="scrollLoading"
                                             src="{{ MEDIA_URL }}{{ teacher.image }}"/>
                                    </div>
                                </a>
                            <div class="btn">
                                <div class="fr btn2 bdsharebuttonbox"
                                     data-text="授课教师-{{ teacher.name }}-Lighten"
                                     data-desc="我在#Lighten#发现了教师“{{ teacher.name }}”，对学习中的小伙伴很有帮助，一起来看看吧。"
                                     data-comment="{{ teacher.name }}金牌讲师，从业年限：{{ teacher.work_years }}年">
                                    <span class="fl">分享</span>
                                    <a href="#" class="bds_more" data-cmd="more"></a>
                                </div>
                            </div>
                            </dt>
                            <dd>
                                <a href="{% url 'org:teacher_detail' teacher.id %}">
                                    <h1>{{ teacher.name }}<span class="key picbig">金牌讲师</span></h1>
                                </a>
                                <ul class="cont">
                                    <li>工作年限：<span>{{ teacher.work_years }}年</span></li>
                                    <li>工作职位：<span>{{ teacher.work_position }}</span></li>
                                    <li>就职公司：<span>{{ teacher.work_company }}&nbsp;</span></li>
                                    <li>年龄：<span>{{ teacher.age }}岁</span></li>
                                    <li>教学特点：<span>{{ teacher.points }}</span></li>
                                </ul>
                            </dd>
                            <a class="buy buyservice" href="{% url 'org:teacher_detail' teacher.id %}"><br/>查看<br/>详情</a>
                        </dl>
                    {% endfor %}

                </div>

                {# 分页 #}
                {% load i18n %}
                <div class="pageturn">
                    <ul class="pagelist">

                        {# 上一页 #}
                        {% if teacher_paginator.has_previous %}
                            <li class="long">
                                {# *.querystring 如: 'page=1' #}
                                <a href="?{{ teacher_paginator.previous_page_number.querystring }}">
                                    上一页
                                </a>
                            </li>
                        {% endif %}

                        {# 分页主体 #}
                        {% for page in teacher_paginator.pages %}
                            {# p.pages返回如: 1, 2, None, 5, 6, None, 9 #}
                            {% if page %}
                                {# 当前页面高亮显示 #}
                                <li{% if page == teacher_paginator.number %} class="active"{% endif %}>
                                    <a href="?{{ page.querystring }}">
                                        {{ page }}
                                    </a>
                                </li>
                            {% else %}
                                <li>...</li>
                            {% endif %}
                        {% endfor %}

                        {# 下一页 #}
                        {% if teacher_paginator.has_next %}
                            <li class="long">
                                <a href="?{{ teacher_paginator.next_page_number.querystring }}">
                                    下一页
                                </a>
                            </li>
                        {% endif %}
                    </ul>
                </div>

            </div>

            {# 讲师排行榜 #}
            <div class="right layout">
                <div class="head">讲师排行榜</div>

                {% for teacher in hot_teachers %}
                    <dl class="des">
                        <span class="num fl">{{ forloop.counter }}</span>
                        <a href="{% url 'org:teacher_detail' teacher.id %}">
                            <dt>
                                <img width="50" height="50" class="scrollLoading"
                                     src="{{ MEDIA_URL }}{{ teacher.image }}"/>
                            </dt>
                        </a>
                        <dd>
                            <a href="{% url 'org:teacher_detail' teacher.id %}">
                                <h1 title="{{ teacher.name }}">{{ teacher.name }}</h1>
                            </a>
                            <p>工作年限：<span>{{ teacher.work_years }}年</span></p>
                        </dd>
                    </dl>
                {% endfor %}

            </div>
        </div>
    </section>
{% endblock %}
